#pragma once

#include <linux/compiler_attributes.h>

#define __rcu
#define __force
#define __kernel

#define __acquires(x)
#define __releases(x)
#define __percpu

#ifndef __PASTE
/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
#define ___PASTE(a, b) a##b
#define __PASTE(a, b) ___PASTE(a, b)
#endif

/*
 * The below symbols may be defined for one or more, but not ALL, of the above
 * compilers. We don't consider that to be an error, so set them to nothing.
 * For example, some of them are for compiler specific plugins.
 */
#ifndef __latent_entropy
#define __latent_entropy
#endif

#define notrace

/*
 * __unqual_scalar_typeof(x) - Declare an unqualified scalar type, leaving
 *			       non-scalar types unchanged.
 */
/*
 * Prefer C11 _Generic for better compile-times and simpler code. Note: 'char'
 * is not type-compatible with 'signed char', and we define a separate case.
 */
#define __scalar_type_to_expr_cases(type) \
    unsigned type : (unsigned type)0,     \
                    signed type : (signed type)0

#define __unqual_scalar_typeof(x)                      \
    typeof(_Generic((x),                               \
               char: (char)0,                          \
               __scalar_type_to_expr_cases(char),      \
               __scalar_type_to_expr_cases(short),     \
               __scalar_type_to_expr_cases(int),       \
               __scalar_type_to_expr_cases(long),      \
               __scalar_type_to_expr_cases(long long), \
               default: (x)))

/* Is this type a native word size -- useful for atomic operations */
#define __native_word(t)                                        \
    (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
     sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))

/**
 * compiletime_assert - break build and emit msg if condition is false
 * @condition: a compile-time constant condition to check
 * @msg:       a message to emit if condition is false
 *
 * In tradition of POSIX assert, this macro will break the build if the
 * supplied condition is *false*, emitting the supplied error message if the
 * compiler has support to do so.
 */
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)

#define __private
#define ACCESS_PRIVATE(p, member) ((p)->member)
